package com.adv.ems.controller.job;

import com.adv.ems.model.dto.APIResponse;
import com.adv.ems.service.EnergyReportDataService;
import com.adv.ems.service.OriginalDataDispatchEnergyDataService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

@RestController
@RequestMapping
public class DataDealJobController {
    @Resource
    OriginalDataDispatchEnergyDataService originalDataDispatchEnergyDataService;
    @Resource
    EnergyReportDataService energyReportDataService;

    @Scheduled(initialDelay = 60000, fixedDelay = 1000)
    @RequestMapping("/original/data/deal")
    public APIResponse<Boolean> originalDataDealJob() {
        originalDataDispatchEnergyDataService.begin();
        return APIResponse.<Boolean>build().content(true);
    }

    @Scheduled(initialDelay = 60000, fixedDelay = 1000)
    @RequestMapping("/data/report")
    public APIResponse<Boolean> dataReportJob() {
        energyReportDataService.begin();
        return APIResponse.<Boolean>build().content(true);
    }
}
